﻿using bbtpClient.Entities;
using bbtpClient.WebServices;

namespace bbtpClient.Controllers
{
    public static class OrderController
    {
        private readonly static OrderControllerClient Instance = new OrderControllerClient("OrderControllerImplPort", Program.Host + "orderController");

        public static Order GetOrder(long orderId)
        {
            return Instance.getOrder(UserInfo.SessionId, orderId);
        }

        public static void SaveOrder(Order order)
        {
            Instance.saveOrder(UserInfo.SessionId, order);
        }

        public static void CancelOrder(long orderId)
        {
            Instance.cancelOrder(UserInfo.SessionId, orderId);
        }

        public static void SetTransportCompanyForOrder(long orderId, long transportCompanyId)
        {
            Instance.setTransportCompanyForOrder(UserInfo.SessionId, orderId, transportCompanyId);
        }

        public static OrderHead[] GetAllOrders()
        {
            return Instance.getAllOrders(UserInfo.SessionId);
        }

        public static OrderHead[] GetOrdersForReturn()
        {
            return Instance.getOrdersForReturn(UserInfo.SessionId);
        }

        public static OrderHead[] GetReadyOrders()
        {
            return Instance.getReadyOrders(UserInfo.SessionId);
        }

        public static void CreateOrder(Order order, Client client)
        {
            Instance.createOrder(UserInfo.SessionId, order, client);
        }

        public static void CreateOrderForReturn(long orderId)
        {
            Instance.createOrderForReturn(UserInfo.SessionId, orderId);
        }

        public static OrderHead[] GetSentOrders()
        {
            return Instance.getSentOrders(UserInfo.SessionId);
        }

    }
}
